import java.util.ArrayList;
import java.util.List;

public class Test {

    public static void main(String[] args) {

      List<String> ss = new ArrayList<>();
//      List<Object> objs = ss;//这么写会存在安全问题，编译报错

//        List<String> strs = new ArrayList<>();
//        addAllExtends(strs);
//
//
//        List<CharSequence> strSupers = new ArrayList<>();
//        addAllSuper(strSupers);

        String a = "$";
        a = a.replaceAll("\\$", "\\[\\$\\]");
        System.out.println(a);
    }

    /**
     * ?通配符 extends Object 限制上限
     *
     * @param list
     */
    public static void addAllExtends(List<? extends Object> list) {
        System.out.println("list = [" + list + "]");
    }

    /**
     * ?通配符 super String 限制下限
     *
     * @param list
     */
    public static void addAllSuper(List<? super String> list) {
        System.out.println("list = [" + list + "]");
    }
}
